//
//  LeftViewController.m
//  FNer
//
//  Created by dllo on 15/11/5.
//  Copyright © 2015年 刘志强. All rights reserved.
//

#import "LeftViewController.h"
#import "RESideMenu.h"
#import "MyTabBar.h"
#import "IconViewController.h"
#import "NewsViewController.h"
#import "PhotoViewController.h"
@interface LeftViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,retain)UITableView *tableView;
@end

@implementation LeftViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor= [UIColor clearColor];
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, (self.view.frame.size.height - 54 * 5) / 2.0f, self.view.frame.size.width, 54 * 5) style:UITableViewStylePlain];
    _tableView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleWidth;
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.opaque = NO;
    _tableView.backgroundColor = [UIColor clearColor];
    _tableView.backgroundView = nil;
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    _tableView.bounces = NO;
    [self.view addSubview:_tableView];

    
    
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 54;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
        cell.backgroundColor = [UIColor clearColor];
        cell.textLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:21];
        cell.textLabel.textColor = [UIColor whiteColor];
        cell.textLabel.highlightedTextColor = [UIColor lightGrayColor];
        cell.selectedBackgroundView = [[UIView alloc] init];
    }
    
    NSArray *titles = @[@"首页", @"达人", @"最新", @"美图"];

    NSArray *images = @[@"IconHome", @"IconCalendar", @"IconProfile", @"IconSettings"];
    cell.textLabel.text = titles[indexPath.row ];
    cell.imageView.image = [UIImage imageNamed:images[indexPath.row]];
   
    return cell;
}






- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    switch (indexPath.row) {
        case 0:
            [self.sideMenuViewController setContentViewController:[MyTabBar shareMyTabBar]animated:YES];
            
            [self.sideMenuViewController hideMenuViewController];
            break;
        case 1:
        {
            
            
            IconViewController * Icon=[[IconViewController alloc]init];
            UINavigationController * IconnaVC=[[UINavigationController alloc]initWithRootViewController:Icon];
            [self.sideMenuViewController setContentViewController:IconnaVC animated:YES];
            [self.sideMenuViewController hideMenuViewController];
            break;
            
        }
        case 2:
        {
            NewsViewController *news =[[NewsViewController alloc]init];
            UINavigationController *navc= [[UINavigationController alloc]initWithRootViewController:news];
            [self.sideMenuViewController setContentViewController:navc animated:YES];
            [self.sideMenuViewController hideMenuViewController];
            break;
            
        }
        case 3:
        {
            PhotoViewController *p = [[PhotoViewController alloc]init];
            UINavigationController *navc =[[UINavigationController alloc]initWithRootViewController:p];
         //   p.navigationItem.title = @"meitu";
            [self.sideMenuViewController setContentViewController:navc animated:YES];
            
            [self.sideMenuViewController hideMenuViewController];
            break;
        
        }
            
    
            break;
    }
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
